package com.mical.demo.dto;


import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

public class MessageRequest {

    public enum MessageType {
        TEXT,
        IMAGE,
        AUDIO
    }

    @NotNull(message = "消息类型不能为空")
    private MessageType type;

    @NotBlank(message = "消息内容不能为空")
    private String content;

    // 文件扩展名（可选，用于图片/语音消息）
    private String fileExtension;

    // 无参构造器
    public MessageRequest() {
    }

    // 带参构造器
    public MessageRequest(MessageType type, String content) {
        this.type = type;
        this.content = content;
    }

    // Getter 和 Setter 方法
    public MessageType getType() {
        return type;
    }

    public void setType(MessageType type) {
        this.type = type;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getFileExtension() {
        return fileExtension;
    }

    public void setFileExtension(String fileExtension) {
        this.fileExtension = fileExtension;
    }

    // toString 方法（调试用）
    @Override
    public String toString() {
        return "MessageRequest{" +
                "type=" + type +
                ", content='" + (content.length() > 20 ? content.substring(0, 20) + "..." : content) + '\'' +
                ", fileExtension='" + fileExtension + '\'' +
                '}';
    }
}